Polymer({
    //定义卡片id，该id在card.html的<dom-module>标签中被引用。
    is: "PC-CARD-HTML-4952848077669557-01",
    properties: {
        card_title: {
            type: String,
            export: true,
            default: "办公通知"
        },
        page_size: {
            type: String,
            export: true,
            default:"6"
        },
        thumbnail: {
            type: String,
            export: true,
            default: "thumbnail.png"
        },
        target_platform: {
            type: String,
            export: true,
            default: "WEB"
        },
        first_title: {
            type: String
        },
        first_department: {
            type: String
        },
        first_time: {
            type: String
        },
        news: {
            type: Array
        }
    },
    ajaxRoot: location.origin,
    ajaxRoot: "http://ehall.nwsuaf.edu.cn",
    ready: function() {
        var widget = this;
        $.get(widget.ajaxRoot + '/form/user/anonymous/zxgg_index_exchange_json.jsp').done(function(resp){
            var newsArr = [];
            var json=$.parseJSON(resp);

            // 左侧数据的展示
            if(json.length>0) {
                var pageSize=widget.page_size>json.length?json.length:widget.page_size;
                for (var i=0;i<pageSize;i++){
                    var notice=json[i];
                    var time = notice.ggfbsj ? notice.ggfbsj.split(" ")[0] : "";
                    newsArr.push({
                        noticeTitle: notice.ggzt,
                        sendTime: time,
                        hasAttach: "",
                        detailUrl: 'http://oa.nwsuaf.edu.cn/form/user/anonymous/zxgg_readcount.jsp?processInsId=' + notice.procid
                    });
                }
/*                $.each(json, function(idx, notice){

                });*/
            }
            widget.news = newsArr;

            widget.fire("widgetComplete");
        });
    }
});
